package basic;

public class NBAPlayer1 {
    private String name;
    private int age;
    // 无参构造方法
    //public NBAPlayer1(){
    //
    //}
    //单参构造法
//    public NBAPlayer1(){
//    }
    //全参构造法
//    public NBAPlayer1(String name, int age){
//        this.setName(name);
//        this.setAge(age);
//    }

    public String getName(){
        return name;
    }

    public void setName(String name){
        this.name = name;
    }

    public int getAge(){
        return age;
    }

    public void setAge(int age){
        if(age < 0){
            this.age = 0;
        }
        this.age = age;
    }

    public static void main(String[] args) {
        NBAPlayer1 james = new NBAPlayer1();
        james.setName("James");
        james.setAge(35);
        System.out.println("姓名：" + james.getName());
        System.out.println("年龄：" + james.getAge());
        System.out.println("------------");
//        NBAPlayer1 jordan = new NBAPlayer1("乔丹",60);
//        System.out.println("姓名：" + jordan.getName());
//        System.out.println("年龄：" + jordan.getAge());
    }
}
